package 继承;

public abstract class Person {
    private int age;//年龄
    private String name;//姓名

public abstract void study();

    public Person() {//父类构造方法

    }

    public Person(int age, String name) {
        this.age = age;
        this.name = name;
    }
//访问私有成员的方法 通过公共方法set和get
    public void setAge(int age) {
        this.age = age;
    }
    public void SetName(String name){
        this.name=name;
    }

    public int getAge() {
        return age;
    }

    public String getName() {
        return name;
    }

    public void eat(){
        System.out.println("吃");
    }
    public void sleep(){
        System.out.println("睡");
    }

    @Override
    public String toString() {
        return name+"\t"+age;
    }
}
